define(['app'], function(app) {
    'use strict';

    //实例化方法
    var factory = function (Http) {
		
        //返回信息
        return {
            //获取首页数据
            product_detail: function(goods_id, act_id,product_id,callback) {
				Http.post({
					method: 'goods.seckill.detail',
					goods_id: goods_id,
					act_id:act_id,
					product_id:product_id
				}, function(result) {
					console.log(result);
					if(callback)
						callback(result);
				}, function(e) {

				}, function() {

				});
			},
			add_favorite_store: function(store_id, callback) {
				Http.post({
					method:'member.favorite.addstore',
					store_id:store_id
				},function(result){
					if(callback)
					callback(result);
				},function(e){

				},function(){

				})

			},
			fastbuy:function(goods_id,products,num,callback){
				Http.post({
					method:'cart.set_cart',
					goods_id:goods_id,
					type:'spike',
					products:products,
					num:num,
					status:'fastbuy'
				},function(result){
					if(callback)
					callback(result);
				})
			},
			buy:function(goods_id,products_id,num,act_id,callback){
				Http.post({
					method:'marketing.seckill.checkOut',
					goods_id:goods_id,
					product_id:products_id,
					num:num,
					act_id:act_id
				},function(result){
					if(callback)
					callback(result);
				})
			},
			add_favorite: function(goods_id, callback) {
				Http.post({
					method:'member.favorite.addgoods',
					goods_id:goods_id
				},function(result){
					if(callback)
					callback(result);
				},function(e){

				},function(){

				})

			},
			del_favorite:function(goods_id,callback){
				Http.post({
					method:'member.favorite.dellgoods',
					goods_id:goods_id
				},function(result){
					if(callback){
						callback(result)
					}
				})
			},
			add_favorite_store: function(store_id, callback) {
				Http.post({
					method:'member.favorite.addstore',
					store_id:store_id
				},function(result){
					if(callback)
					callback(result);
				},function(e){

				},function(){

				})

			},
			//客服列表
			//客服QQ与联系方式
			contact_show: function(store_id,callback) {
				Http.post({
					method: 'shop.cusphone.getlist',
					store_id:store_id
				}, function(result) {
					//函数回调
					if(callback)
						callback(result.result);
				}, function(e) {

				}, function() {

				});
			}
            
        };
    }

    factory.$inject = ['Http'];
    return app.registerService("Seckillgoods", factory);
});